<!DOCTYPE html>
<html>

	<head>
		<title>加载ArcGIS for Server地图数据demo</title>
		<link rel="stylesheet" href="css/bootstrap.css">
		<link rel="stylesheet" href="css/ol.css" type="text/css">
		<script src="js/jquery.js"></script>
		<script src="js/bootstrap.js"></script>
		<script src="js/ol-debug.js"></script>
	</head>

	<body>

		<div id="map" class="map"></div>

		<script>
			var url = 'http://10.120.20.114:6080/arcgis/rest/services/China/MapServer';
//			var url = "http://10.120.20.122:6080/arcgis/rest/services/dongli/FTZMapService/MapServer";
			var source = new ol.source.TileArcGISRest({
				url: url
			});
			var sourceProj = source.getProjection();
			var layer = new ol.layer.Tile({
//				extent: ol.proj.transformExtent([116.09839901600749,39.14881004182331,118.930317595793,40.12918084941042],"EPSG:4326","EPSG:3857"),
				source: source
			});
			var layer2 = new ol.layer.Tile({
				source: new ol.source.MapQuest({
					layer: 'sat'
				}),
				opacity: 0.7
			});
			var map = new ol.Map({
				layers: [layer2/*, layer*/],
				target: 'map',
				view: new ol.View({
					center: ol.proj.fromLonLat([117.1, 39.5]),
					extent: ol.proj.transformExtent([116.09839901600749,39.14881004182331,118.930317595793,40.12918084941042],"EPSG:4326","EPSG:3857"),
					zoom: 11
				})
			});
			var control = new ol.control.MousePosition({
				projection:"EPSG:4326"
			});
			map.addControl(control);
			map.on("pointermove",function(evt){
				console.log(map.getPixelFromCoordinate(evt.coordinate));
			});
		</script>
	</body>

</html>